package com.bl.weilan.manager.controller.companyteam;

import com.bl.weilan.common.ApiResponseBody;
import com.bl.weilan.manager.controller.BaseController;
import com.bl.weilan.service.biz.companyteam.CompanyTeamService;
import com.bl.weilan.service.vo.DelBody;
import com.bl.weilan.service.vo.companyteam.CompanyTeamAddVo;
import com.bl.weilan.service.vo.institution.InstitutionAddVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

@RestController
@Log4j2
@RequestMapping(value = {"/weilan/manager/companyteam"})
@Api(value = "公司管理团队信息", description = "公司管理团队信息")
public class CompanyTeamController extends BaseController {
    @Autowired
    CompanyTeamService companyTeamService;


    @ApiOperation(value = "新增机构信息", notes = "新增机构信息 ")
    @ApiImplicitParams({})
    @PostMapping(value = {"/add"})
    public ApiResponseBody add(
            @Valid @RequestBody CompanyTeamAddVo body, BindingResult result,
            HttpServletRequest request) {

        ApiResponseBody validResult = validParams(result);
        if (validResult != null) {
            return validResult;
        }
        companyTeamService.add(body);
        return ApiResponseBody.createSuccessBody(null);
    }


    @ApiOperation(value = "删除公司管理团队信息", notes = "删除公司管理团队信息 ")
    @ApiImplicitParams({
    })
    @PostMapping(value = {"/del"})
    public ApiResponseBody del(
            @Valid @RequestBody DelBody body, BindingResult result,
            HttpServletRequest request) {

        companyTeamService.del(body);

        return ApiResponseBody.createSuccessBody(null);
    }

}
